<!--
 - Author : 003.
 - Date   : 2018/10/18.
 - File   : 头部.vue.
 -->

<template>
  <div class="page-head">
    <img src="../assets/images/logo.png" alt="" style="width:70px;margin-right:10px;">
      <div class="page-head-left">后台管理系统<span style="font-size:24px;"> {{title}}</span></div> 
    <div class="page-head-right">
      <span class="user"> <span style="font-weight: normal;margin-right: -8px;"> {{travelName}}</span><i class="iconfont icon-member"></i> {{userName}}&nbsp; </span>
      <slot ></slot>
      <span class="logout"  @click="logout"> <i class="iconfont icon-tuichu"></i> 退出</span>
    </div>
  </div>
</template>

<script>
  import {apiSource} from '../travel-api'
  export default {
    data() {
      return {
        userName:JSON.parse(localStorage.getItem('bookingName')),
        travelName:''
      }
    },
    props: {
      title: {
        type: String,
        default: ''
      }
    },
    watch: {
    },
    mounted(){
      // this.getTravelDetail()
    },
    methods: {
      /**
       * 旅行社详情
       * page (integer): 当前显示页，取值范围[1,10000000]。 ,
       * pageSize (integer): 每页显示条数，取值范围[1,100]。 ,
       * travelId (string): 旅行社ID
       */
      getTravelDetail(){
        var self=this
        apiSource({
          type: 'outer',
          service: 'travelAuditGet',
          ct: {page: 1, pageSize: 10}
        }).then((res) => {
          self.travelName = res.countResultMap.travelName
        })
      },
      logout(){
        var self = this
        this.$Modal.confirm({
          title: '确认?',
          content: `确认退出当前用户吗?`,
          onOk: function() {
            self.$router.push({path:'/booking/login'})
            window.localStorage.removeItem('booking')
            window.localStorage.removeItem('bookingName')
          }
        });
      }
    }
  }

</script>

<style lang="less">
</style>
